﻿using Prism.Events;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using WPF.Project.Demo.Common.Events;

namespace WPF.Project.Demo.Extensions
{
    public static class DialogExtensions
    {
        /// <summary>
        /// 发送等待消息 loading
        /// </summary>
        /// <param name="aggregator"></param>
        /// <param name="model"></param>
        public static void UpdateLoading(this IEventAggregator aggregator, UpdateLoadingModel model)
        {
            aggregator.GetEvent<UpdateLoadingEvent>().Publish(model);   
        }

        /// <summary>
        /// 注册等待消息 loading
        /// </summary>
        /// <param name="aggregator"></param>
        /// <param name="action"></param>
        public static void Resgiter(this IEventAggregator aggregator, Action<UpdateLoadingModel> action)
        {
            aggregator.GetEvent<UpdateLoadingEvent>().Subscribe(action);
        }

    }
}
